package math.base
{
	
	import flash.display.Sprite;
	import flash.geom.*;
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	public class BaseObject extends Sprite
	{
		public var R:Number;//半径
		private var container:DisplayObjectContainer;
		public function BaseObject()
		{
			
		}
		//外部容器设置
		public function set contain(mycontain:DisplayObjectContainer):void
		{
			this.container=mycontain;
		}
		
		public function get contain():DisplayObjectContainer
		{
			return this.container;
		}
		//深度比较
		public function depthSort(objA:DisplayObject,objB:DisplayObject):int
		{
			var posA:Vector3D=objA.transform.matrix3D.position;
			posA=container.transform.matrix3D.deltaTransformVector(posA);
			
			var posB:Vector3D=objB.transform.matrix3D.position;
			posB=container.transform.matrix3D.deltaTransformVector(posB);
			return posB.z-posA.z;
		}
	}
	
}